delta-show: Don't dump whole superblock, do show fallback checksums
authorColin Walters <walters@verbum.org>
Fri, 10 Feb 2017 21:10:20 +0000 (16:10 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 17 Feb 2017 14:58:25 +0000 (14:58 +0000)
Doing `g_variant_print (superblock)` is unreadable and not very useful,
since we show the checksums as byte arrays.

However, do show the checksums for fallback objects. This makes it easier to see
which objects are fallbacks (and inspect why).

Closes: #678
Approved by: giuseppe

src/libostree/ostree-repo-static-delta-core.c

index edbf965be86afb1be17e386410f49ed059798c26..1ab11ed771d57cd24476da5f86f2cf633dab6951 100644 (file)
@@ -884,10 +884,6 @@ _ostree_repo_static_delta_dump (OstreeRepo                    *self,
                                OT_VARIANT_MAP_TRUSTED, &delta_superblock, error))
     goto out;
 
-  { g_autofree char *variant_string = g_variant_print (delta_superblock, 1);
-    g_print ("%s\n", variant_string);
-  }
-
   g_print ("Delta: %s\n", delta_id);
   { const char *endianness_description;
     gboolean was_heuristic;
@@ -940,9 +936,13 @@ _ostree_repo_static_delta_dump (OstreeRepo                    *self,
     for (i = 0; i < n_fallback; i++)
       {
         guint64 size, usize;
-        g_variant_get_child (fallback, i, "(y@aytt)", NULL, NULL, &size, &usize);
+        g_autoptr(GVariant) checksum_v = NULL;
+        char checksum[65];
+        g_variant_get_child (fallback, i, "(y@aytt)", NULL, &checksum_v, &size, &usize);
+        ostree_checksum_inplace_from_bytes (ostree_checksum_bytes_peek (checksum_v), checksum);
         size = maybe_swap_endian_u64 (swap_endian, size);
         usize = maybe_swap_endian_u64 (swap_endian, usize);
+        g_print ("  %s\n", checksum);
         total_fallback_size += size;
         total_fallback_usize += usize;
       }